package com.repair.payment.pojo.convertor;

import com.repair.api.pay.request.param.PaymentAddParam;
import com.repair.api.pay.response.vo.PaymentInfoVO;
import com.repair.payment.pojo.entity.Payment;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author chunyu
 * @since 2024/10/4,20:07
 */
@Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface PaymentConvertor {

    PaymentConvertor INSTANCE = Mappers.getMapper(PaymentConvertor.class);

    /**
     * PaymentAddParam 转为 Payment
     * @param paymentAddParam
     * @return
     */
    Payment mapToEntity(PaymentAddParam paymentAddParam);

    /**
     * Payment 转为 PaymentVO
     * @param payment
     * @return
     */
    PaymentInfoVO mapToVO(Payment payment);

    /**
     * List<Payment> 转为 List<PaymentVO>
     * @param records
     * @return
     */
    List<PaymentInfoVO> mapToVOList(List<Payment> records);
}
